# from http://wiki.ros.org/IntelROSProject

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
source devel/setup.bash
echo $ROS_PACKAGE_PATH

sudo apt-get install -y git

# Install NCSDK v1.12.00 
# from https://github.com/movidius/ncsdk

cd ~
git clone https://github.com/movidius/ncsdk.git
cd ncsdk
make install

# Install NC APP Zoo
cd ~
git clone https://github.com/movidius/ncappzoo.git
cd ~/ncappzoo/caffe/SSD_MobileNet
make all

# NCSDK should be installed in /opt/movidius by default. Create a symbol link in /opt/movidius to NC APP Zoo.
sudo ln -s ~/ncappzoo /opt/movidius/ncappzoo



# from https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installing-the-packages

sudo ln -s /usr/lib/x86_64-linux-gnu/libusb-1.0.a /usr/lib/libusb.a

echo 'deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main' | sudo tee /etc/apt/sources.list.d/realsense-public.list
sudo apt-key adv --keyserver keys.gnupg.net --recv-key 6F3EFCDE
sudo apt-get update
sudo apt-get install -y librealsense2-dkms librealsense2-utils librealsense2-dev librealsense2-dbg


# from https://github.com/intel-ros/realsense


mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/

git clone https://github.com/intel-ros/realsense.git
cd realsense
git checkout 2.0.2

catkin_init_workspace 
cd ~/catkin_ws
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

sudo apt install -y ros-kinetic-rgbd-launch


# install object_msgs package
# install ros_intel_movidius_ncs package
# from https://github.com/intel/ros_intel_movidius_ncs

cd ~/catkin_ws/src
git clone https://github.com/intel/object_msgs
git clone https://github.com/intel/ros_intel_movidius_ncs.git
cd ros_intel_movidius_ncs
git checkout master

cd ~/catkin_ws
catkin_make
catkin_make install
source install/setup.bash

# Copy label files from this project to the installation location of NCSDK
cp ~/catkin_ws/src/ros_intel_movidius_ncs/data/labels/* /opt/movidius/ncappzoo/data/ilsvrc12/

# install ros_object_analytics package

# from https://github.com/intel/ros_object_analytics

cd ~/catkin_ws/src
git clone https://github.com/intel/ros_object_analytics.git

cd ~/catkin_ws
catkin_make
catkin_make run_tests
catkin_make install




